﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace com.zhongjh.Library.Common
{
    public class Folder
    {
        /// <summary>
        /// 创建文件夹路径(有则不创建)
        /// </summary>
        /// <param name="p_FolderPath"></param>
        /// <returns></returns>
        public static bool CreateFolderPath(string p_strFolderPath)
        {
            bool result = false;

            string folderPath = string.Empty;
            string[] temp = p_strFolderPath.Split('\\');

            if (temp[temp.Length - 1].Contains("."))
            {
                for (int i1 = 0; i1 < temp.Length - 1; i1++)
                {
                    folderPath += temp[i1] + @"\";
                }
            }
            else
            {
                folderPath = p_strFolderPath;
            }

            if (!File.Exists(folderPath))
                Directory.CreateDirectory(folderPath);
            result = true;

            return result;
        }
    }
}
